package com.inifitness.common.model;

import java.util.List;

import com.fasterxml.jackson.annotation.JsonInclude;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 下拉选项列表
 *
 * @author sunjinfeng
 * @version 1.0.0
 * @since 2024/04/18 11:00:00
 */
@Schema(description = "下拉选项对象")
@Data
@NoArgsConstructor
public class Option<T> {

  public Option(T value, String label) {
    this.value = value;
    this.label = label;
  }

  public Option(T value, String label, List<Option<?>> children) {
    this.value = value;
    this.label = label;
    this.children = children;
  }

  @Schema(description = "选项的值")
  private T value;

  @Schema(description = "选项的标签")
  private String label;

  @Schema(description = "子选项列表")
  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  private List<Option<?>> children;

}
